(* stack.pp *)

unit stack;

interface
uses nodes;
var 
top : link;
procedure push(a: node);
function pop() : node;
procedure construct(n : integer);

implementation

procedure push(a: node);
var
   t : link ;
   x : info;
begin
   x := a.item;
   new(t);
   t^.item := x;
   t^.next := top;
   top := t;
end; { push }

function pop() : node;
var
   t : link;
   a : node;
begin
   a.item := top^.item;
   a.next := top^.next;
   t := top^.next;
   top := t;
   pop := a;
end; { pop }

procedure construct(n : integer);
var
i:integer;
nodenull : node;
begin 
nodenull.item.tag := true;
nodenull.item.suit := ' ';
nodenull.item.rank := 0;
nodenull.item.title := ' ';
nodenull.next := nil;
  for i := 0 to NodesNr do
    push(nodenull);
end;
   
end.
